home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Source.bin / ScrollingPanelBeanInfo.java < prev    next >
Text File  |  1998-10-19  |  17KB  |  443 lines

  1. package symantec.itools.awt;
  2.  
  3. import java.beans.*;
  4. import symantec.itools.beans.*;
  5. import java.util.ResourceBundle;
  6.  
  7. //  08/04/97    LAB    Removed the component from the toolbar since it is being deprecated.
  8. //  09/07/97    LAB    Fixed misspelling of descriptions. Removed from ToolBar.
  9. //    09/19/97    RKM    Removed it from toolbar again - please do not readd it
  10. //  08/19/98    LAB    Moved to GroupAWTAdditions folder.
  11.  
  12. /**
  13.  * BeanInfo for ScrollingPanel.
  14.  *
  15.  */
  16. public class ScrollingPanelBeanInfo extends SimpleBeanInfo {
  17.  
  18.     /**
  19.      * Constructs a ScrollingPanelBeanInfo object.
  20.      */
  21.     public ScrollingPanelBeanInfo() {
  22.     }
  23.  
  24.     /**
  25.      * Gets a BeanInfo for the superclass of this bean.
  26.      * @return BeanInfo[] containing this bean's superclass BeanInfo
  27.      */
  28.     public BeanInfo[] getAdditionalBeanInfo() {
  29.         try {
  30.             BeanInfo[] bi = new BeanInfo[1];
  31.             bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
  32.             return bi;
  33.         }
  34.         catch (IntrospectionException e) { throw new Error(e.toString());}
  35.     }
  36.  
  37.     /**
  38.      * Gets the SymantecBeanDescriptor for this bean.
  39.      * @return an object of type SymantecBeanDescriptor
  40.      * @see symantec.itools.beans.SymantecBeanDescriptor
  41.      */
  42.     public BeanDescriptor getBeanDescriptor() {
  43.         ResourceBundle group = ResourceBundle.getBundle("symantec.itools.resources.GroupBundle");
  44.         String s=group.getString("GroupAWTAdditions");
  45.  
  46.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  47.         bd.setFolder(s);
  48.         bd.setWinHelp("0x123B7");
  49.  
  50.         return (BeanDescriptor) bd;
  51.     }
  52.  
  53.     /**
  54.      * Gets an image that may be used to visually represent this bean
  55.      * (in the toolbar, on a form, etc).
  56.      * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
  57.      * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
  58.      * @return an image for this bean, always color even if requested monochrome
  59.      * @see BeanInfo#ICON_MONO_16x16
  60.      * @see BeanInfo#ICON_COLOR_16x16
  61.      * @see BeanInfo#ICON_MONO_32x32
  62.      * @see BeanInfo#ICON_COLOR_32x32
  63.      */
  64.     public java.awt.Image getIcon(int iconKind) {
  65.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  66.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  67.             java.awt.Image img = loadImage("ScrollingPanelC16.gif");
  68.             return img;
  69.         }
  70.  
  71.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  72.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  73.             java.awt.Image img = loadImage("ScrollingPanelC32.gif");
  74.             return img;
  75.         }
  76.  
  77.         return null;
  78.     }
  79.  
  80.     /**
  81.      * Gets an array of descriptions of the methods used for "connections" by
  82.      * Visual CafΘ's Interaction Wizard.
  83.      * Included in each method description is a CONNECTIONS ConnectionDescriptor.
  84.      * @return method descriptions for this bean
  85.      * @see symantec.itools.beans.ConnectionDescriptor#CONNECTIONS
  86.      */
  87.     public MethodDescriptor[] getMethodDescriptors() {
  88.         Class[] args;
  89.         ConnectionDescriptor connection;
  90.         java.util.Vector connections;
  91.         java.util.Vector md = new java.util.Vector();
  92.         ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
  93.  
  94.         try{
  95.             args = null;
  96.             MethodDescriptor scrollLeft = new MethodDescriptor(beanClass.getMethod("scrollLeft", args));
  97.  
  98.             connections = new java.util.Vector();
  99.             connection = new ConnectionDescriptor("input", "void", "",
  100.                                     "%name%.scrollLeft();",
  101.                                     conn.getString("scrollLeft"));
  102.             connections.addElement(connection);
  103.  
  104.             scrollLeft.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  105.             md.addElement(scrollLeft);
  106.         } catch (Exception e) { throw new Error("scrollLeft:: " + e.toString()); }
  107.  
  108.         try{
  109.             args = null;
  110.             MethodDescriptor getShowVerticalScroll = new MethodDescriptor(beanClass.getMethod("getShowVerticalScroll", args));
  111.  
  112.             connections = new java.util.Vector();
  113.             connection = new ConnectionDescriptor("output", "boolean", "",
  114.                                     "%name%.getShowVerticalScroll()",
  115.                                     conn.getString("getShowVerticalScrollVisible"));
  116.             connections.addElement(connection);
  117.  
  118.             connection = new ConnectionDescriptor("output", "boolean", "",
  119.                                     "!%name%.getShowVerticalScroll()",
  120.                                     conn.getString("getShowVerticalScrollHidden"));
  121.             connections.addElement(connection);
  122.  
  123.             getShowVerticalScroll.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  124.             md.addElement(getShowVerticalScroll);
  125.         } catch (Exception e) { throw new Error("getShowVerticalScroll:: " + e.toString()); }
  126.  
  127.         try{
  128.             args = null;
  129.             MethodDescriptor getMinimumHeight = new MethodDescriptor(beanClass.getMethod("getMinimumHeight", args));
  130.  
  131.             connections = new java.util.Vector();
  132.             connection = new ConnectionDescriptor("output", "int", "",
  133.                                     "%name%.getMinimumHeight()",
  134.                                     conn.getString("getMinimumHeight"));
  135.             connections.addElement(connection);
  136.  
  137.             getMinimumHeight.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  138.             md.addElement(getMinimumHeight);
  139.         } catch (Exception e) { throw new Error("getMinimumHeight:: " + e.toString()); }
  140.  
  141.         try{
  142.             args = new Class[1];
  143.             args[0] = java.lang.Integer.TYPE ;
  144.             MethodDescriptor setScrollLineIncrement = new MethodDescriptor(beanClass.getMethod("setScrollLineIncrement", args));
  145.  
  146.             connections = new java.util.Vector();
  147.             connection = new ConnectionDescriptor("input", "int", "",
  148.                                     "%name%.setScrollLineIncrement(%arg%);",
  149.                                     conn.getString("setScrollLineIncrement"));
  150.             connections.addElement(connection);
  151.  
  152.             setScrollLineIncrement.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  153.             md.addElement(setScrollLineIncrement);
  154.         } catch (Exception e) { throw new Error("setScrollLineIncrement:: " + e.toString()); }
  155.  
  156.         try{
  157.             args = new Class[1];
  158.             args[0] = java.lang.Integer.TYPE ;
  159.             MethodDescriptor setMinimumWidth = new MethodDescriptor(beanClass.getMethod("setMinimumWidth", args));
  160.  
  161.             connections = new java.util.Vector();
  162.             connection = new ConnectionDescriptor("input", "int", "",
  163.                                     "%name%.setMinimumWidth(%arg%);",
  164.                                     conn.getString("setMinimumWidth"));
  165.             connections.addElement(connection);
  166.  
  167.             setMinimumWidth.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  168.             md.addElement(setMinimumWidth);
  169.         } catch (Exception e) { throw new Error("setMinimumWidth:: " + e.toString()); }
  170.  
  171.         try{
  172.             args = null;
  173.             MethodDescriptor scrollPageRight = new MethodDescriptor(beanClass.getMethod("scrollPageRight", args));
  174.  
  175.             connections = new java.util.Vector();
  176.             connection = new ConnectionDescriptor("input", "void", "",
  177.                                     "%name%.scrollPageRight();",
  178.                                     conn.getString("scrollPageRight"));
  179.             connections.addElement(connection);
  180.  
  181.             scrollPageRight.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  182.             md.addElement(scrollPageRight);
  183.         } catch (Exception e) { throw new Error("scrollPageRight:: " + e.toString()); }
  184.  
  185.         try{
  186.             args = null;
  187.             MethodDescriptor scrollPageDown = new MethodDescriptor(beanClass.getMethod("scrollPageDown", args));
  188.  
  189.             connections = new java.util.Vector();
  190.             connection = new ConnectionDescriptor("input", "void", "",
  191.                                     "%name%.scrollPageDown();",
  192.                                     conn.getString("scrollPageDown"));
  193.             connections.addElement(connection);
  194.  
  195.             scrollPageDown.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  196.             md.addElement(scrollPageDown);
  197.         } catch (Exception e) { throw new Error("scrollPageDown:: " + e.toString()); }
  198.  
  199.         try{
  200.             args = null;
  201.             MethodDescriptor scrollDown = new MethodDescriptor(beanClass.getMethod("scrollDown", args));
  202.  
  203.             connections = new java.util.Vector();
  204.             connection = new ConnectionDescriptor("input", "void", "",
  205.                                     "%name%.scrollDown();",
  206.                                     conn.getString("scrollDown"));
  207.             connections.addElement(connection);
  208.  
  209.             scrollDown.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  210.             md.addElement(scrollDown);
  211.         } catch (Exception e) { throw new Error("scrollDown:: " + e.toString()); }
  212.  
  213.         try{
  214.             args = new Class[1];
  215.             args[0] = java.lang.Integer.TYPE ;
  216.             MethodDescriptor setMinimumHeight = new MethodDescriptor(beanClass.getMethod("setMinimumHeight", args));
  217.  
  218.             connections = new java.util.Vector();
  219.             connection = new ConnectionDescriptor("input", "int", "",
  220.                                     "%name%.setMinimumHeight(%arg%);",
  221.                                     conn.getString("setMinimumHeight"));
  222.             connections.addElement(connection);
  223.  
  224.             setMinimumHeight.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  225.             md.addElement(setMinimumHeight);
  226.         } catch (Exception e) { throw new Error("setMinimumHeight:: " + e.toString()); }
  227.  
  228.         try{
  229.             args = null;
  230.             MethodDescriptor getScrollLineIncrement = new MethodDescriptor(beanClass.getMethod("getScrollLineIncrement", args));
  231.  
  232.             connections = new java.util.Vector();
  233.             connection = new ConnectionDescriptor("output", "int", "",
  234.                                     "%name%.getScrollLineIncrement()",
  235.                                     conn.getString("getScrollLineIncrement"));
  236.             connections.addElement(connection);
  237.  
  238.             getScrollLineIncrement.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  239.             md.addElement(getScrollLineIncrement);
  240.         } catch (Exception e) { throw new Error("getScrollLineIncrement:: " + e.toString()); }
  241.  
  242.         try{
  243.             args = null;
  244.             MethodDescriptor getShowHorizontalScroll = new MethodDescriptor(beanClass.getMethod("getShowHorizontalScroll", args));
  245.  
  246.             connections = new java.util.Vector();
  247.             connection = new ConnectionDescriptor("output", "boolean", "",
  248.                                     "%name%.getShowHorizontalScroll()",
  249.                                     conn.getString("getShowHorizontalScrollVisible"));
  250.             connections.addElement(connection);
  251.  
  252.             connection = new ConnectionDescriptor("output", "boolean", "",
  253.                                     "!%name%.getShowHorizontalScroll()",
  254.                                     conn.getString("getShowHorizontalScrollHidden"));
  255.             connections.addElement(connection);
  256.  
  257.             getShowHorizontalScroll.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  258.             md.addElement(getShowHorizontalScroll);
  259.         } catch (Exception e) { throw new Error("getShowHorizontalScroll:: " + e.toString()); }
  260.  
  261.         try{
  262.             args = null;
  263.             MethodDescriptor scrollUp = new MethodDescriptor(beanClass.getMethod("scrollUp", args));
  264.  
  265.             connections = new java.util.Vector();
  266.             connection = new ConnectionDescriptor("input", "void", "",
  267.                                     "%name%.scrollUp();",
  268.                                     conn.getString("scrollUp"));
  269.             connections.addElement(connection);
  270.  
  271.             scrollUp.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  272.             md.addElement(scrollUp);
  273.         } catch (Exception e) { throw new Error("scrollUp:: " + e.toString()); }
  274.  
  275.         try{
  276.             args = new Class[1];
  277.             args[0] = java.lang.Integer.TYPE ;
  278.             MethodDescriptor scrollHorizontalAbsolute = new MethodDescriptor(beanClass.getMethod("scrollHorizontalAbsolute", args));
  279.  
  280.             connections = new java.util.Vector();
  281.             connection = new ConnectionDescriptor("input", "int", "",
  282.                                     "%name%.scrollHorizontalAbsolute(%arg%);",
  283.                                     conn.getString("scrollHorizontalAbsolute"));
  284.             connections.addElement(connection);
  285.  
  286.             scrollHorizontalAbsolute.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  287.             md.addElement(scrollHorizontalAbsolute);
  288.         } catch (Exception e) { throw new Error("scrollHorizontalAbsolute:: " + e.toString()); }
  289.  
  290.         try{
  291.             args = null;
  292.             MethodDescriptor getMinimumWidth = new MethodDescriptor(beanClass.getMethod("getMinimumWidth", args));
  293.  
  294.             connections = new java.util.Vector();
  295.             connection = new ConnectionDescriptor("output", "int", "",
  296.                                     "%name%.getMinimumWidth()",
  297.                                     conn.getString("getMinimumWidth"));
  298.             connections.addElement(connection);
  299.  
  300.             getMinimumWidth.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  301.             md.addElement(getMinimumWidth);
  302.         } catch (Exception e) { throw new Error("getMinimumWidth:: " + e.toString()); }
  303.  
  304.         try{
  305.             args = null;
  306.             MethodDescriptor scrollPageUp = new MethodDescriptor(beanClass.getMethod("scrollPageUp", args));
  307.  
  308.             connections = new java.util.Vector();
  309.             connection = new ConnectionDescriptor("input", "void", "",
  310.                                     "%name%.scrollPageUp();",
  311.                                     conn.getString("scrollPageUp"));
  312.             connections.addElement(connection);
  313.  
  314.             scrollPageUp.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  315.             md.addElement(scrollPageUp);
  316.         } catch (Exception e) { throw new Error("scrollPageUp:: " + e.toString()); }
  317.  
  318.         try{
  319.             args = null;
  320.             MethodDescriptor getVerticalGap = new MethodDescriptor(beanClass.getMethod("getVerticalGap", args));
  321.  
  322.             connections = new java.util.Vector();
  323.             connection = new ConnectionDescriptor("output", "int", "",
  324.                                     "%name%.getVerticalGap()",
  325.                                     conn.getString("getVerticalGap"));
  326.             connections.addElement(connection);
  327.  
  328.             getVerticalGap.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  329.             md.addElement(getVerticalGap);
  330.         } catch (Exception e) { throw new Error("getVerticalGap:: " + e.toString()); }
  331.  
  332.         try{
  333.             args = null;
  334.             MethodDescriptor scrollRight = new MethodDescriptor(beanClass.getMethod("scrollRight", args));
  335.  
  336.             connections = new java.util.Vector();
  337.             connection = new ConnectionDescriptor("input", "void", "",
  338.                                     "%name%.scrollRight();",
  339.                                     conn.getString("scrollRight"));
  340.             connections.addElement(connection);
  341.  
  342.             scrollRight.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  343.             md.addElement(scrollRight);
  344.         } catch (Exception e) { throw new Error("scrollRight:: " + e.toString()); }
  345.  
  346.         try{
  347.             args = new Class[1];
  348.             args[0] = java.lang.Integer.TYPE ;
  349.             MethodDescriptor scrollVerticalAbsolute = new MethodDescriptor(beanClass.getMethod("scrollVerticalAbsolute", args));
  350.  
  351.             connections = new java.util.Vector();
  352.             connection = new ConnectionDescriptor("input", "int", "",
  353.                                     "%name%.scrollVerticalAbsolute(%arg%);",
  354.                                     conn.getString("scrollVerticalAbsolute"));
  355.             connections.addElement(connection);
  356.  
  357.             scrollVerticalAbsolute.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  358.             md.addElement(scrollVerticalAbsolute);
  359.         } catch (Exception e) { throw new Error("scrollVerticalAbsolute:: " + e.toString()); }
  360.  
  361.         try{
  362.             args = null;
  363.             MethodDescriptor getHorizontalGap = new MethodDescriptor(beanClass.getMethod("getHorizontalGap", args));
  364.  
  365.             connections = new java.util.Vector();
  366.             connection = new ConnectionDescriptor("output", "int", "",
  367.                                     "%name%.getHorizontalGap()",
  368.                                     conn.getString("getHorizontalGap"));
  369.             connections.addElement(connection);
  370.  
  371.             getHorizontalGap.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  372.             md.addElement(getHorizontalGap);
  373.         } catch (Exception e) { throw new Error("getHorizontalGap:: " + e.toString()); }
  374.  
  375.         try{
  376.             args = null;
  377.             MethodDescriptor scrollPageLeft = new MethodDescriptor(beanClass.getMethod("scrollPageLeft", args));
  378.  
  379.             connections = new java.util.Vector();
  380.             connection = new ConnectionDescriptor("input", "void", "",
  381.                                     "%name%.scrollPageLeft();",
  382.                                     conn.getString("scrollPageLeft"));
  383.             connections.addElement(connection);
  384.  
  385.             scrollPageLeft.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  386.             md.addElement(scrollPageLeft);
  387.         } catch (Exception e) { throw new Error("scrollPageLeft:: " + e.toString()); }
  388.  
  389.         MethodDescriptor[] rv = new MethodDescriptor[md.size()];
  390.         md.copyInto(rv);
  391.  
  392.         return rv;
  393.     }
  394.  
  395.     /**
  396.      * Returns descriptions of this bean's properties.
  397.      */
  398.     public PropertyDescriptor[] getPropertyDescriptors() {
  399.         ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.resources.PropBundle");
  400.  
  401.         try{
  402.         PropertyDescriptor minimumWidth = new PropertyDescriptor("minimumWidth", beanClass);
  403.         minimumWidth.setBound(true);
  404.         minimumWidth.setConstrained(false);
  405.         minimumWidth.setDisplayName(prop.getString("minimumWidth"));
  406.  
  407.         PropertyDescriptor minimumHeight = new PropertyDescriptor("minimumHeight", beanClass);
  408.         minimumHeight.setBound(true);
  409.         minimumHeight.setConstrained(false);
  410.         minimumHeight.setDisplayName(prop.getString("minimumHeight"));
  411.         
  412.         PropertyDescriptor scrollLineIncrement = new PropertyDescriptor("scrollLineIncrement", beanClass);
  413.         scrollLineIncrement.setBound(true);
  414.         scrollLineIncrement.setConstrained(false);
  415.         scrollLineIncrement.setDisplayName(prop.getString("scrollLineIncrement"));
  416.         
  417.         PropertyDescriptor scrollbarHeight = new PropertyDescriptor("HScrollbarHeight", beanClass, "getHScrollbarHeight", null);
  418.         scrollbarHeight.setHidden(true);
  419.  
  420.         PropertyDescriptor scrollbarWidth = new PropertyDescriptor("VScrollbarWidth", beanClass, "getVScrollbarWidth", null);
  421.         scrollbarWidth.setHidden(true);
  422.  
  423.         PropertyDescriptor scrollbarPolicy = new PropertyDescriptor("scrollbarDisplayPolicy", beanClass, "getScrollbarDisplayPolicy", null);
  424.         scrollbarPolicy.setHidden(true);
  425.  
  426.         PropertyDescriptor layout = new PropertyDescriptor("layout", beanClass);
  427.         layout.setHidden(true);
  428.  
  429.         PropertyDescriptor[] rv = {
  430.             minimumWidth,
  431.             minimumHeight,
  432.             scrollLineIncrement,
  433.             scrollbarHeight,
  434.             scrollbarWidth,
  435.             scrollbarPolicy,
  436.             layout};
  437.         return rv;
  438.         } catch (IntrospectionException e) { throw new Error(e.toString()); }
  439.     }
  440.  
  441.     private final static Class beanClass = ScrollingPanel.class;
  442.  
  443.     }    //  end of class ScrollingPanelBeanInfo